Skip to content

Conversation

snorwin
Copy link
Member

@snorwin snorwin commented Oct 7, 2025

What type of PR is this?

/kind gep

What this PR does / why we need it:
This proposes a first provisional GEP (what/why/who) for enabling flexible TLS validation in BackendTLSPolicy, allowing options such as skip verification and certificate pinning to better support scenarios as described in #3761.

Which issue(s) this PR fixes:

This supports, but does not resolve #4152.

Does this PR introduce a user-facing change?:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/gep PRs related to Gateway Enhancement Proposal(GEP) cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Oct 7, 2025
@k8s-ci-robot k8s-ci-robot requested review from candita and kflynn October 7, 2025 11:30
@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Oct 7, 2025
@snorwin
Copy link
Member Author

snorwin commented Oct 7, 2025

/cc @rikatz

@rikatz
Copy link
Member

rikatz commented Oct 7, 2025

/assign


The current `BackendTLSPolicy` follows a secure-by-default approach that requires users to provide a trusted CA certificate bundle or rely on the system’s default certificate store (which typically includes root CAs) to validate backend server certificates. However, real-world deployments include cases where strict certificate validation may not be possible or practical, e.g., Development and testing environments that use self-signed certificates generated dynamically at runtime.

In such scenarios, users may need the flexibility to disable certificate verification, or to use certificate pinning. Certificate pinning offers a safer and more controlled alternative, instead of bypassing TLS validation, the gateway verifies that the backend’s certificate matches a known fingerprint or public key hash. This preserves the confidentiality and integrity guarantees of TLS while removing the operational overhead of managing full certificate chains or trusted CA bundles.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a question: cert pinning CAN be combined with BackendTLSPolicy to also offer a safer approach than the current as well today, right? (like I accept just from this CA + this hash)

Do you think it is worth mentioning it here, or do we want a different GEP for certificate pinning explaining what it will be used for? (eg.: as you have here: https://github.com/kubernetes-sigs/gateway-api/pull/4079/files)

I think probably it is fine to keep separated what matters on client certificate from what matters on backend/server certificate.

Maybe to avoid confusion, call it Extending TLS Validation in BackendTLSPolicy as the validation of the CA and SAN already exists on it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Certificate pinning could technically be combined with CA validation. IMO, that approach doesn’t make much sense as I can’t think of a real-world use case where you’d want to both trust a specific certificate (or its fingerprint) and also require it to be signed by a particular CA. When you decide to trust a certificate’s hash, you’re already asserting its authenticity, so checking the CA that signed it adds little value.

I also considered creating a separate GEP for the certificate pinning feature, but it would be unfortunate if it remained stuck in the Provisional phase. Since many users are primarily asking for the ability to skip TLS validation, I’d prefer to include certificate pinning as part of the same proposal. This way, we can provide a more secure alternative to completely disabling certificate validation, especially for environments using self-signed certificates.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, my point is that certificate pinning is just an additional field as

SubjectAltNames []SubjectAltName `json:"subjectAltNames,omitempty"`
because thinking on the opposite case:

  • I trust the CA
  • I don't have CRL (yet)
  • I want to be sure that the cert I am using is well known (eg.: if the old one is revoked, and you have a new one with a new hash, you can enforce that new one)

Not a blocker, mostly thinking that the pinning being used as an aggregated validation mechanism could also be considered

@snorwin snorwin changed the title docs: add provisional GEP for flexible TLS Validation in BackendTLSPolicy docs: add provisional GEP for extending TLS Validation in BackendTLSPolicy Oct 7, 2025
Signed-off-by: Norwin Schnyder <[email protected]>
@rikatz
Copy link
Member

rikatz commented Oct 7, 2025

/lgtm
Thanks!
/cc @robscott @shaneutt @youngnick
for approval / another pass

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 7, 2025
Copy link
Member

@shaneutt shaneutt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have one blocking comment I would like to see resolved.

/hold

Beyond that however I approve.

/approve

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 7, 2025
Signed-off-by: Norwin Schnyder <[email protected]>
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 8, 2025
@snorwin snorwin requested a review from rikatz October 8, 2025 07:37
Copy link
Member

@shaneutt shaneutt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the goal about runtime indicators added, I think this is a great first PR.

/unhold

Thank you @snorwin

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 8, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: shaneutt, snorwin

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Comment on lines 41 to 42
* As a gateway operator, I want to control whether skipping TLS verification is
permitted for specific Gateways.
Copy link
Contributor

@mikemorris mikemorris Oct 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like having this as a user story, it would address my concern from #3761 (comment) and feels aligned with the consumer override approach proposed by @howardjohn in #3876

@mikemorris
Copy link
Contributor

This feels like a good initial direction to address the use cases described in #3761

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 8, 2025
@k8s-ci-robot k8s-ci-robot merged commit 4c4ed14 into kubernetes-sigs:main Oct 8, 2025
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/gep PRs related to Gateway Enhancement Proposal(GEP) lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GEP: Extending TLS Validation in BackendTLSPolicy
5 participants